#ifndef LONGKEY_IM_CONTROLS_LIST_FRIENTDS_H_
#define LONGKEY_IM_CONTROLS_LIST_FRIENTDS_H_

#include "ListNodeUI.h"

namespace DuiLib
{

	struct ListIMItemInfo
	{
		bool folder;
		bool empty;
		TString id;
		TString image;
		TString title;
		TString subtitle;
	};

	class CListIMUI : public CListUI
	{
	public:
		enum {SCROLL_TIMERID = 10};

		CListIMUI(CPaintManagerUI& paint_manager);
		~CListIMUI();

		bool Add(CControlUI* pControl);
		bool AddAt(CControlUI* pControl, int index);
		bool Remove(CControlUI* pControl);
		bool RemoveAt(int index);
		void RemoveAll();

		void DoEvent(TEventUI& event);

		UIListNode* GetRoot();

		UIListNode* AddNode(const ListIMItemInfo& item, UIListNode* parent = NULL);
		bool RemoveNode(UIListNode* node);

		void SetChildVisible(UIListNode* node, bool visible);

		bool CanExpand(UIListNode* node) const;

		bool SelectItem(int index, bool bTakeFocus = false);

	private:
		UIListNode* root_node_;

		LONG		delay_deltaY_;
		DWORD		delay_number_;
		DWORD		delay_left_;

		CDuiRect	text_padding_;
		int			level_text_start_pos_;

		TString		level_expand_image_;
		TString		level_collapse_image_;
		CPaintManagerUI& paint_manager_;

		CDialogBuilder m_dlgBuilder;
	};

}

#endif	// LONGKEY_IM_CONTROLS_LIST_FRIENTDS_H_
